﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using BLL;
namespace 丘丘书屋2._0
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        Shop_BLL shop_BLL = new Shop_BLL();
        #region 页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Drop();
                Rpt(0);
            }
        }
        #endregion
        #region 下拉框绑定
        public void Drop()
        {
            @short.DataSource = shop_BLL.Drop_Data();
            @short.DataTextField = "Category_Name";
            @short.DataValueField = "Category_ID";
            @short.DataBind();
            @short.Items.Insert(0, new ListItem("全部类型", "0"));
        }
        #endregion
        #region Rpt绑定
        public void Rpt(int CategoryID)
        {
            List<Model.Shop_Model> shop_Models = shop_BLL.Products_Select(CategoryID);
            Rpt_Shop.DataSource =shop_Models;
            Rpt_Shop.DataBind();
            LbCount.Text=$"查询到{shop_Models.Count}条数据";
        }
        #endregion
        #region 下拉框查询Shop内容
        protected void short_SelectedIndexChanged1(object sender, EventArgs e)
        {
            int CategoryID = Convert.ToInt32(@short.SelectedValue);
            Rpt(CategoryID);
        }

        protected void Big_Click(object sender, EventArgs e)
        {

        }

        #endregion
        //Model.Shop_Model shop_Model = (Model.Shop_Model)e.Item.DataItem;
        //int id=Convert.ToInt32(shop_Model.Products_ID);
        //Response.Redirect($"index.aspx?id={id}");
    }
}